package com.common.base.tools.utils;

import android.graphics.drawable.Drawable;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;


public class BindingAdapter {

    //start url
    @androidx.databinding.BindingAdapter(value = {"image"}, requireAll = false)
    public static void loadImage(ImageView imageView, Drawable image) {
        Glide.with(imageView.getContext())
                .load(image)
                .into(imageView);
    }
//
//    @androidx.databinding.BindingAdapter({"image", "error"})
//    public static void loadImage(ImageView imageView, String image, Drawable errorDrawable) {
//        Glide.with(imageView.getContext())
//                .load(image)
//                .error(errorDrawable)
//                .into(imageView);
//    }
//
//    @androidx.databinding.BindingAdapter({"image", "placeHolder", "error"})
//    public static void loadImage(ImageView imageView, String image, Drawable holderDrawable, Drawable errorDrawable) {
//        Glide.with(imageView.getContext())
//                .load(image)
//                .placeholder(holderDrawable)
//                .error(errorDrawable)
//                .into(imageView);
//    }
//
//
//
//    @androidx.databinding.BindingAdapter({"image", "radius"})
//    public static void loadImage(ImageView imageView, String image, float radius) {
//        Glide.with(imageView.getContext())
//                .load(image)
//                .apply(new RequestOptions().optionalTransform(new RoundedCorners((int) radius)))
//                .into(imageView);
//    }
//
//    @androidx.databinding.BindingAdapter({"image", "radius", "error"})
//    public static void loadImage(ImageView imageView, String image, float radius, Drawable errorDrawable) {
//        Glide.with(imageView.getContext())
//                .load(image)
//                .apply(new RequestOptions().optionalTransform(new RoundedCorners((int) radius)))
//                .error(errorDrawable)
//                .into(imageView);
//    }
//
//    @androidx.databinding.BindingAdapter({"image", "radius", "placeHolder", "error"})
//    public static void loadImage(ImageView imageView, String image, float radius, Drawable holderDrawable, Drawable errorDrawable) {
//        Glide.with(imageView.getContext())
//                .load(image)
//                .apply(new RequestOptions().optionalTransform(new RoundedCorners((int) radius)))
//                .placeholder(holderDrawable)
//                .error(errorDrawable)
//                .into(imageView);
//    }
//    //end url
//
//    //start Drawable
//    @androidx.databinding.BindingAdapter("image")
//    public static void loadImage(ImageView imageView, Drawable image) {
//        Glide.with(imageView.getContext())
//                .load(image)
//                .into(imageView);
//    }
//
//    @androidx.databinding.BindingAdapter({"image", "error"})
//    public static void loadImage(ImageView imageView, Drawable image, Drawable errorDrawable) {
//        Glide.with(imageView.getContext())
//                .load(image)
//                .error(errorDrawable)
//                .into(imageView);
//    }
//
//
//
//    @androidx.databinding.BindingAdapter({"image", "placeHolder", "error"})
//    public static void loadImage(ImageView imageView, Drawable image, Drawable holderDrawable, Drawable errorDrawable) {
//        Glide.with(imageView.getContext())
//                .load(image)
//                .placeholder(holderDrawable)
//                .error(errorDrawable)
//                .into(imageView);
//    }
//
//    @androidx.databinding.BindingAdapter({"image", "radius"})
//    public static void loadImage(ImageView imageView, Drawable image, float radius) {
//        Glide.with(imageView.getContext())
//                .load(image)
//                .apply(new RequestOptions().optionalTransform(new RoundedCorners((int) radius)))
//                .into(imageView);
//    }
//
//    @androidx.databinding.BindingAdapter({"image", "radius", "error"})
//    public static void loadImage(ImageView imageView, Drawable image, float radius, Drawable errorDrawable) {
//        Glide.with(imageView.getContext())
//                .load(image)
//                .apply(new RequestOptions().optionalTransform(new RoundedCorners((int) radius)))
//                .error(errorDrawable)
//                .into(imageView);
//    }
//
//    @androidx.databinding.BindingAdapter({"image", "radius", "placeHolder", "error"})
//    public static void loadImage(ImageView imageView, Drawable image, float radius, Drawable holderDrawable, Drawable errorDrawable) {
//        Glide.with(imageView.getContext())
//                .load(image)
//                .apply(new RequestOptions().optionalTransform(new RoundedCorners((int) radius)))
//                .placeholder(holderDrawable)
//                .error(errorDrawable)
//                .into(imageView);
//    }
//    //end Drawable
//
//    //start RoundImage
//    @androidx.databinding.BindingAdapter({"roundImage"})
//    public static void loadRoundImage(ImageView imageView, String roundImage) {
//        Glide.with(imageView.getContext())
//                .load(roundImage)
//                .circleCrop()
//                .into(imageView);
//    }
//
//    @androidx.databinding.BindingAdapter({"roundImage", "error"})
//    public static void loadRoundImage(ImageView imageView, String roundImage, Drawable errorDrawable) {
//        Glide.with(imageView.getContext())
//                .load(roundImage)
//                .error(errorDrawable)
//                .circleCrop()
//                .into(imageView);
//    }
//
//    @androidx.databinding.BindingAdapter({"roundImage"})
//    public static void loadRoundImage(ImageView imageView, Drawable roundImage) {
//        Glide.with(imageView.getContext())
//                .load(roundImage)
//                .circleCrop()
//                .into(imageView);
//    }
//    //end RoundImage
//
//    @androidx.databinding.BindingAdapter("rund")
//    public static void rund(TextView textView,String str){
//        textView.setSelected(true);
//    }

}
